﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Web.Security;
using Biljart.Model;
using Biljart.Model.Service;

namespace Services
{
    [ServiceContract(Namespace = "")]
    [SilverlightFaultBehavior]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class UserWebService
    {
        private readonly UserService _userService;

        public UserWebService()
        {
            _userService = new UserService();
        }

        [OperationContract]
        public IEnumerable<User> GetUsers()
        {
            return _userService.GetUsers();
        }

        [OperationContract]
        public IEnumerable<User> GetUsersByIds(HashSet<long> ids)
        {
            return _userService.GetUsers(ids);
        }

        [OperationContract]
        public User GetUser(long id)
        {
            return _userService.GetUser(id);
        }

        [OperationContract]
        public bool AddUser(User user, string password, string email)
        {
            return _userService.AddUser(user, password, email);
        }
    }
}
